package controller

import (
	"fmt"
	"net/http"

	"alolang.org.cn/api/server/model"
	"github.com/gin-gonic/gin"
)

// Ping ping-pong测试
func Ping() gin.HandlerFunc {
	return func(c *gin.Context) {
		c.String(http.StatusOK, "Pong")
	}
}

// PingLogin 登录测试
func PingLogin() gin.HandlerFunc {
	return func(c *gin.Context) {
		claims := c.MustGet("claims").(*model.UserClaims)
		c.String(http.StatusOK, "Pong, you are "+claims.UserName+", session expires at "+fmt.Sprint(claims.ExpiresAt))
	}
}
